package com.yc.thread.pro2_knn.bean;

/**
 * 这个类主要用于比较两个distance之间的大小
 *
 * @author zwei
 * @create 2024-07-17 20:13
 */
public class Distance implements Comparable<Distance> {
    private int index;
    private double distance;

    //比较当前这个distance和传进来的参数o的大小
    @Override
    public int compareTo(Distance o) {
        if (this.distance > o.distance) {
            return 1;
        } else if (this.distance == o.distance) {
            return 0;
        } else {
            return 0;
        }
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public void setDistance(double distance) {
        this.distance = distance;
    }

    public int getIndex() {
        return index;
    }

    public double getDistance() {
        return distance;
    }
//第index条数据的距离

}
